using DataDynamics.ActiveReports;
using DataDynamics.ActiveReports.Export.Xls;
using SM.core;
using SS;
using SS.dir;
using System;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
using TVSGPP.tools;
namespace TVSBH.func
{
	public class frmBalancer : Form
	{
		private Func objFunc = new Func();
		private DataTable objTable = new DataTable();
		private Bill objBill = new Bill();
		private string strConnection = "";
		public string userName = "";
		public string fullName = "";
		public string sqlQuery = "";
		private bool IsPostBack = false;
		private int currGroup = 0;
		private frmWaitting objW;
		private IContainer components = null;
		private DataGridView dgvProduct;
		private Button btnClose;
		private GroupBox groupBox1;
		private ComboBox cbbParentGID;
		private System.Windows.Forms.Label label1;
		private Button btnPrint;
		private Button btnSearch;
		private System.Windows.Forms.TextBox txtSearch;
		private Button btnExportToExcel;
		private System.Windows.Forms.Label lblSumMoney;
		private System.Windows.Forms.Label lblSumOut;
		private System.Windows.Forms.Label lblSumIn;
		private System.Windows.Forms.Label lblSumBalancer;
		private System.Windows.Forms.Label lblCountItem;
		private ComboBox cbbWareHouse;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label5;
		private DataGridView dgvListProduct;
		private System.Windows.Forms.CheckBox ckbProduct;
		private DataGridViewTextBoxColumn dg2;
		private DataGridViewTextBoxColumn dg6;
		private Button btnMakeOrderBill;
		private System.Windows.Forms.Label label3;
		private ComboBox cbbType;
		private DataGridViewTextBoxColumn Column2;
		private DataGridViewTextBoxColumn Column3;
		private DataGridViewTextBoxColumn Column1;
		private DataGridViewTextBoxColumn Column7;
		private DataGridViewTextBoxColumn Column8;
		private DataGridViewTextBoxColumn Column4;
		private DataGridViewTextBoxColumn Column5;
		private DataGridViewTextBoxColumn Column6;
		private DataGridViewTextBoxColumn ProductPrice;
		private DataGridViewTextBoxColumn Column10;
		private DataGridViewTextBoxColumn Column9;
		private System.Windows.Forms.Label label2;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn6;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn8;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn9;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn10;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn11;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn12;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn13;
		public frmBalancer()
		{
			Program.strConnectionString = this.objFunc.strConnectionString;
			this.InitializeComponent();
		}
		private void frmInput_Load(object sender, EventArgs e)
		{
			this.cbbType.SelectedIndex = 2;
			this.objFunc.LoadComboBoxStock("SELECT WareHouse_ID, UPPER(WareHouse_Name) AS Name FROM TabWareHouse ORDER BY WareHouse_Name", this.cbbWareHouse, "WareHouse_ID", "Name");
			this.objFunc.LoadComboBoxGProduct("SELECT GpID, UPPER(GpName) AS GpName FROM [TabGproducts] ORDER BY [GpName]", this.cbbParentGID, "GpID", "GpName");
			this.dgvProduct.AutoGenerateColumns = false;
			this.IsPostBack = true;
			this.btnSearch.PerformClick();
		}
		private void btnClose_Click(object sender, EventArgs e)
		{
			base.Close();
		}
		private void frmInput_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Escape)
			{
				base.Close();
			}
		}
		private void btnPrint_Click(object sender, EventArgs e)
		{
		}
		private void cbbParentGID_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (this.IsPostBack)
			{
				try
				{
					if (this.cbbParentGID.SelectedValue.ToString() != "0")
					{
						if (this.IsPostBack)
						{
							this.currGroup = int.Parse(this.cbbParentGID.SelectedValue.ToString());
						}
						string text = this.cbbWareHouse.SelectedValue.ToString();
						if (text != "0")
						{
							text = " AND StockID = '" + text + "'";
						}
						else
						{
							text = "";
						}
						this.getDetailBalancer("SELECT *,(productNumberIn - productNumberOut)*productPrice AS ProductMoneyAll FROM [TabTotalBalancer] WHERE [Pid] IN (SELECT [Pid] FROM [TabProducts] WHERE [GpID] = " + this.cbbParentGID.SelectedValue.ToString() + ")" + text);
					}
					else
					{
						this.currGroup = 0;
						this.sqlQuery = "";
						this.getDetailBalancer(this.sqlQuery);
					}
					this.searchProducts(this.dgvListProduct);
				}
				catch
				{
				}
			}
		}
		public void getDetailBalancer(string sqlQuery)
		{
			try
			{
				string str = "";
				string text = this.cbbWareHouse.SelectedValue.ToString();
				if (text != "0")
				{
					text = " WHERE StockID = '" + text + "'";
				}
				else
				{
					text = " WHERE 1 = 1 ";
				}
				if (this.IsPostBack)
				{
					if (this.cbbType.SelectedIndex == 0)
					{
						str = " AND PID IN (SELECT Pid FROM TabProducts WHERE [SellWithBill] = 1) ";
					}
					else
					{
						if (this.cbbType.SelectedIndex == 1)
						{
							str = " AND PID IN (SELECT Pid FROM TabProducts WHERE [SellWithBill] = 0) ";
						}
						else
						{
							str = "";
						}
					}
				}
				DataTable dataTable = new DataTable();
				DataColumn column = new DataColumn("Pid", typeof(string));
				DataColumn column2 = new DataColumn("ProductName", typeof(string));
				DataColumn column3 = new DataColumn("Packet", typeof(string));
				DataColumn column4 = new DataColumn("CreateDate", typeof(DateTime));
				DataColumn column5 = new DataColumn("ProductExpiryDate", typeof(DateTime));
				DataColumn column6 = new DataColumn("ProductNumber", typeof(float));
				DataColumn column7 = new DataColumn("ProductNumberOut", typeof(float));
				DataColumn column8 = new DataColumn("ProductNumberBalancer", typeof(float));
				DataColumn column9 = new DataColumn("ProductMoney", typeof(float));
				DataColumn column10 = new DataColumn("ProductUnit", typeof(string));
				DataColumn column11 = new DataColumn("ProductPrice", typeof(float));
				dataTable.Columns.Add(column);
				dataTable.Columns.Add(column2);
				dataTable.Columns.Add(column3);
				dataTable.Columns.Add(column4);
				dataTable.Columns.Add(column5);
				dataTable.Columns.Add(column6);
				dataTable.Columns.Add(column7);
				dataTable.Columns.Add(column8);
				dataTable.Columns.Add(column9);
				dataTable.Columns.Add(column10);
				dataTable.Columns.Add(column11);
				SqlConnection sqlConnection = new SqlConnection(Program.strConnectionString);
				sqlConnection.Open();
				SqlCommand sqlCommand = sqlConnection.CreateCommand();
				if (sqlQuery == "")
				{
					sqlCommand.CommandText = "SELECT *, ISNULL((productNumberIn - productNumberOut)*productPrice,0) AS ProductMoneyAll FROM [TabTotalBalancer] " + text + str + " ORDER BY [ProductName]";
				}
				else
				{
					sqlCommand.CommandText = sqlQuery;
				}
				SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
				int num = 0;
				double num2 = 0.0;
				double num3 = 0.0;
				double num4 = 0.0;
				double num5 = 0.0;
				while (sqlDataReader.Read())
				{
					if (double.Parse(sqlDataReader["productNumberIn"].ToString()) - double.Parse(sqlDataReader["productNumberOut"].ToString()) > 0.0)
					{
						num2 += double.Parse(sqlDataReader["productNumberIn"].ToString());
						num3 += double.Parse(sqlDataReader["productNumberOut"].ToString());
						num4 += double.Parse(sqlDataReader["productNumberIn"].ToString()) - double.Parse(sqlDataReader["productNumberOut"].ToString());
						num5 += double.Parse(sqlDataReader["ProductMoneyAll"].ToString());
						if (!this.checkProductNameInDataGridView(sqlDataReader["ProductName"].ToString(), sqlDataReader["Packet"].ToString(), dataTable))
						{
							if (!this.checkProductNameInDataGridView(sqlDataReader["ProductName"].ToString(), dataTable))
							{
								num++;
								dataTable.Rows.Add(new object[]
								{
									sqlDataReader["Pid"].ToString(),
									sqlDataReader["ProductName"].ToString().ToUpper(),
									sqlDataReader["Packet"].ToString(),
									sqlDataReader["ProductDate"].ToString().Substring(0, 10),
									sqlDataReader["ProductExpiryDate"].ToString().Substring(0, 10),
									sqlDataReader["productNumberIn"].ToString(),
									sqlDataReader["productNumberOut"].ToString(),
									(double.Parse(sqlDataReader["productNumberIn"].ToString()) - double.Parse(sqlDataReader["productNumberOut"].ToString())).ToString(),
									sqlDataReader["ProductMoneyAll"].ToString(),
									" " + sqlDataReader["ProductUnit"].ToString(),
									sqlDataReader["ProductPrice"].ToString()
								});
							}
							else
							{
								dataTable.Rows.Add(new object[]
								{
									sqlDataReader["Pid"].ToString(),
									"",
									sqlDataReader["Packet"].ToString(),
									sqlDataReader["ProductDate"].ToString().Substring(0, 10),
									sqlDataReader["ProductExpiryDate"].ToString().Substring(0, 10),
									sqlDataReader["productNumberIn"].ToString(),
									sqlDataReader["productNumberOut"].ToString(),
									(double.Parse(sqlDataReader["productNumberIn"].ToString()) - double.Parse(sqlDataReader["productNumberOut"].ToString())).ToString(),
									sqlDataReader["ProductMoneyAll"].ToString(),
									" " + sqlDataReader["ProductUnit"].ToString(),
									sqlDataReader["ProductPrice"].ToString()
								});
							}
						}
					}
				}
				sqlDataReader.Close();
				sqlConnection.Close();
				sqlConnection.Dispose();
				this.btnPrint.Enabled = true;
				this.objTable = dataTable;
				this.dgvProduct.DataSource = this.objTable;
				this.lblCountItem.Text = string.Concat(new string[]
				{
					"Có ",
					num.ToString(),
					" sản phẩm / ",
					this.objTable.Rows.Count.ToString(),
					" lô hàng"
				});
				if (this.objTable.Rows.Count > 0)
				{
					this.btnPrint.Enabled = true;
					this.btnMakeOrderBill.Enabled = true;
					this.btnExportToExcel.Enabled = true;
				}
				else
				{
					this.btnPrint.Enabled = false;
					this.btnMakeOrderBill.Enabled = false;
					this.btnExportToExcel.Enabled = false;
				}
				this.lblSumIn.Text = string.Format(Program.lenAffterDecimal, num2);
				this.lblSumOut.Text = string.Format(Program.lenAffterDecimal, num3);
				this.lblSumBalancer.Text = string.Format(Program.lenAffterDecimal, num4);
				this.lblSumMoney.Text = string.Format(Program.lenAffterDecimal, num5);
			}
			catch
			{
				this.btnPrint.Enabled = false;
				this.btnExportToExcel.Enabled = false;
				this.objTable = null;
				this.dgvProduct.DataSource = this.objTable;
			}
		}
		private bool checkProductNameInDataGridView(string pName, string Packet, DataTable objTable)
		{
			bool result = false;
			for (int i = 0; i < objTable.Rows.Count; i++)
			{
				if (objTable.Rows[i]["ProductName"].ToString().ToUpper() == pName.ToUpper() && objTable.Rows[i]["Packet"].ToString().ToUpper() == Packet.ToUpper())
				{
					result = true;
				}
			}
			return result;
		}
		private bool checkProductNameInDataGridView(string pName, DataTable objTable)
		{
			bool result = false;
			for (int i = 0; i < objTable.Rows.Count; i++)
			{
				if (objTable.Rows[i]["ProductName"].ToString().ToUpper() == pName.ToUpper())
				{
					result = true;
				}
			}
			return result;
		}
		private void btnSearch_Click(object sender, EventArgs e)
		{
			this.getDetailBalancer(this.sqlQuery);
		}
		private void resetDataGridView()
		{
			this.objTable = null;
			this.dgvProduct.DataSource = this.objTable;
			this.btnPrint.Enabled = false;
		}
		private void btnPrint_Click_1(object sender, EventArgs e)
		{
			frmRepBalancer.objTable = new DataTable();
			frmBalancerView frmBalancerView = new frmBalancerView();
			frmBalancerView.productGroup = "Nhóm hàng hoá : Tất cả";
			frmRepBalancer.objTable = this.objTable;
			frmBalancerView.ShowDialog();
		}
		private void showWatting()
		{
			this.objW = new frmWaitting();
			this.objW.ShowDialog();
			Thread.Sleep(40);
		}
		private void txtSearch_KeyDown(object sender, KeyEventArgs e)
		{
			if (this.txtSearch.Text != "")
			{
				if (e.KeyCode == Keys.Return)
				{
					string text = this.cbbWareHouse.SelectedValue.ToString();
					if (text != "0")
					{
						text = " AND StockID = '" + text + "'";
					}
					else
					{
						text = "";
					}
					this.getDetailBalancer(string.Concat(new string[]
					{
						"SELECT *, (productNumberIn - productNumberOut)*productPrice AS ProductMoneyAll FROM [TabTotalBalancer] WHERE [ProductName] LIKE N'%",
						this.txtSearch.Text.ToUpper(),
						"%' ",
						text,
						" ORDER BY [ProductName]"
					}));
				}
			}
		}
		private void btnExportToExcel_Click(object sender, EventArgs e)
		{
			try
			{
				frmRepBalancer.objTable = new DataTable();
				frmRepBalancer.objTable = this.objTable;
				ActiveReport3 activeReport = new frmRepBalancer();
				activeReport.Run();
				XlsExport xlsExport = new XlsExport();
				SaveFileDialog saveFileDialog = new SaveFileDialog();
				saveFileDialog.ShowDialog();
				string text = saveFileDialog.FileName;
				if (text != "")
				{
					if (!text.ToUpper().Contains(".XLS"))
					{
						text += ".xls";
					}
					xlsExport.Export(activeReport.Document, text);
					MessageBox.Show("Hệ thống đã hoàn thành việc xuất dữ liệu ra file Excel", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
				}
				else
				{
					MessageBox.Show("Bạn chưa chọn đường dẫn và tên file cần xuất!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
				}
			}
			catch
			{
			}
		}
		public void searchProducts(DataGridView lv)
		{
			try
			{
				lv.AutoGenerateColumns = false;
				SqlConnection sqlConnection = new SqlConnection(this.objFunc.strConnectionString);
				string str;
				if (this.currGroup != 0)
				{
					str = " AND [GpID] = " + this.currGroup.ToString();
				}
				else
				{
					str = "";
				}
				string str2;
				if (this.txtSearch.Text != "")
				{
					str2 = string.Concat(new string[]
					{
						" AND (Upper(TabProducts.P_Name) LIKE N'%",
						this.txtSearch.Text.ToUpper(),
						"%' OR Upper(TabProducts.NameSearch) LIKE N'%",
						this.txtSearch.Text.ToUpper(),
						"%' ) "
					});
				}
				else
				{
					str2 = " ";
				}
				string cmdText = "SELECT TOP 100 PERCENT 0 AS TT,PID,P_Name,P_PriceBase,P_PriceTrade,P_PriceRetail,UnitName, MinBalance, MaxBalance FROM [TabProducts],[TabUnitProduct] WHERE (Pid IN (SELECT Pid FROM [TabDetailBill])) AND [TabProducts].[P_DonViTinh] = [TabUnitProduct].[UnitID] " + str2 + str + " ORDER BY [P_Name]";
				SqlCommand selectCommand = new SqlCommand(cmdText, sqlConnection);
				SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(selectCommand);
				DataSet dataSet = new DataSet();
				sqlConnection.Open();
				sqlDataAdapter.Fill(dataSet);
				try
				{
					lv.DataSource = dataSet.Tables[0];
				}
				catch
				{
					lv.DataSource = null;
				}
				sqlConnection.Close();
				sqlConnection.Dispose();
				sqlDataAdapter.Dispose();
				dataSet.Dispose();
			}
			catch
			{
			}
		}
		private void dgvRep_CellEnter(object sender, DataGridViewCellEventArgs e)
		{
			if (this.IsPostBack)
			{
				string text = this.cbbWareHouse.SelectedValue.ToString();
				if (text != "0")
				{
					text = " WHERE StockID = '" + text + "'";
				}
				else
				{
					text = "WHERE 1 = 1 ";
				}
				this.getDetailBalancer(string.Concat(new string[]
				{
					"SELECT *, (productNumberIn - productNumberOut)*productPrice AS ProductMoneyAll FROM [TabTotalBalancer] ",
					text,
					" AND [productName] LIKE N'%",
					this.dgvListProduct.Rows[e.RowIndex].Cells["dg2"].Value.ToString(),
					"%' ORDER BY [ProductName]"
				}));
			}
		}
		private void txtSearch_TextChanged(object sender, EventArgs e)
		{
			if (this.IsPostBack)
			{
				this.getProduct(this.txtSearch.Text);
			}
		}
		private void getProduct(string pName)
		{
			try
			{
				this.dgvListProduct.AutoGenerateColumns = false;
				SqlConnection sqlConnection = new SqlConnection(this.objFunc.strConnectionString);
				string text = this.cbbWareHouse.SelectedValue.ToString();
				if (text != "0")
				{
					text = " AND StockID = '" + text + "'";
				}
				else
				{
					text = "";
				}
				string selectCommandText = "SELECT DISTINCT Pid, productName FROM [TabTotalBalancer] WHERE [productName] LIKE N'%" + this.txtSearch.Text.ToUpper() + "%'" + text;
				SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(selectCommandText, sqlConnection);
				DataSet dataSet = new DataSet();
				sqlConnection.Open();
				sqlDataAdapter.Fill(dataSet);
				this.dgvListProduct.DataSource = dataSet.Tables[0];
				sqlConnection.Close();
				sqlConnection.Dispose();
				sqlDataAdapter.Dispose();
				dataSet.Dispose();
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}
		private void dgvListProduct_CellEnter(object sender, DataGridViewCellEventArgs e)
		{
			try
			{
			}
			catch
			{
			}
		}
		private void cbbWareHouse_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (this.IsPostBack)
			{
				this.btnSearch.PerformClick();
			}
		}
		private void btnMakeOrderBill_Click(object sender, EventArgs e)
		{
            //try
            //{
            //    DataTable dt = frmMakeOrderBill.objTable;
            //    dt = this.objTable;
            //    try
            //    {
            //        frmMakeOrderBill.objTable.Columns.Add("ProductNumber", typeof(int));
            //    }
            //    catch
            //    {
            //    }
            //    for (int i = 0; i < frmMakeOrderBill.objTable.Rows.Count; i++)
            //    {
            //        frmMakeOrderBill.objTable.Rows[i]["ProductNumber"] = 0;
            //    }
            //    frmMakeOrderBill frmMakeOrderBill = new frmMakeOrderBill();
            //    frmMakeOrderBill.ShowDialog();
            //    if (frmMakeOrderBill.objTableOrder != null)
            //    {
            //        if (frmMakeOrderBill.objTableOrder.Rows.Count > 0)
            //        {
            //            MessageBox.Show("Đơn hàng đã được lưu tạm thời trên hệ thống\r\n\r\nMở chức năng đặt hàng để hoàn thiện đơn đặt hàng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            //            base.Close();
            //        }
            //    }
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message);
            //}
		}
		private void cbbType_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (this.IsPostBack)
			{
				this.getDetailBalancer("");
			}
		}
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle4 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle5 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle6 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle7 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle8 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle9 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle10 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle11 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle12 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle13 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle14 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle15 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle16 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle17 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle18 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle19 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle20 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle21 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle22 = new DataGridViewCellStyle();
			ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(frmBalancer));
			this.dgvProduct = new DataGridView();
			this.Column2 = new DataGridViewTextBoxColumn();
			this.Column3 = new DataGridViewTextBoxColumn();
			this.Column1 = new DataGridViewTextBoxColumn();
			this.Column7 = new DataGridViewTextBoxColumn();
			this.Column8 = new DataGridViewTextBoxColumn();
			this.Column4 = new DataGridViewTextBoxColumn();
			this.Column5 = new DataGridViewTextBoxColumn();
			this.Column6 = new DataGridViewTextBoxColumn();
			this.ProductPrice = new DataGridViewTextBoxColumn();
			this.Column10 = new DataGridViewTextBoxColumn();
			this.Column9 = new DataGridViewTextBoxColumn();
			this.btnClose = new Button();
			this.groupBox1 = new GroupBox();
			this.cbbType = new ComboBox();
			this.ckbProduct = new System.Windows.Forms.CheckBox();
			this.dgvListProduct = new DataGridView();
			this.dg2 = new DataGridViewTextBoxColumn();
			this.dg6 = new DataGridViewTextBoxColumn();
			this.label5 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.cbbWareHouse = new ComboBox();
			this.txtSearch = new System.Windows.Forms.TextBox();
			this.cbbParentGID = new ComboBox();
			this.label1 = new System.Windows.Forms.Label();
			this.btnPrint = new Button();
			this.btnSearch = new Button();
			this.btnExportToExcel = new Button();
			this.lblSumMoney = new System.Windows.Forms.Label();
			this.lblSumOut = new System.Windows.Forms.Label();
			this.lblSumIn = new System.Windows.Forms.Label();
			this.lblSumBalancer = new System.Windows.Forms.Label();
			this.lblCountItem = new System.Windows.Forms.Label();
			this.btnMakeOrderBill = new Button();
			this.label3 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.dataGridViewTextBoxColumn1 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn2 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn3 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn4 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn5 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn6 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn7 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn8 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn9 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn10 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn11 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn12 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn13 = new DataGridViewTextBoxColumn();
			((ISupportInitialize)this.dgvProduct).BeginInit();
			this.groupBox1.SuspendLayout();
			((ISupportInitialize)this.dgvListProduct).BeginInit();
			base.SuspendLayout();
			this.dgvProduct.AllowUserToAddRows = false;
			this.dgvProduct.AllowUserToDeleteRows = false;
			this.dgvProduct.AllowUserToOrderColumns = true;
			this.dgvProduct.AllowUserToResizeColumns = false;
			this.dgvProduct.AllowUserToResizeRows = false;
			dataGridViewCellStyle.BackColor = Color.FromArgb(192, 255, 255);
			dataGridViewCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle;
			this.dgvProduct.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.dgvProduct.BackgroundColor = Color.White;
			this.dgvProduct.BorderStyle = BorderStyle.Fixed3D;
			this.dgvProduct.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
			this.dgvProduct.Columns.AddRange(new DataGridViewColumn[]
			{
				this.Column2,
				this.Column3,
				this.Column1,
				this.Column7,
				this.Column8,
				this.Column4,
				this.Column5,
				this.Column6,
				this.ProductPrice,
				this.Column10,
				this.Column9
			});
			this.dgvProduct.Cursor = Cursors.Hand;
			this.dgvProduct.EnableHeadersVisualStyles = false;
			this.dgvProduct.Location = new System.Drawing.Point(246, 12);
			this.dgvProduct.MultiSelect = false;
			this.dgvProduct.Name = "dgvProduct";
			this.dgvProduct.ReadOnly = true;
			this.dgvProduct.RowHeadersVisible = false;
			this.dgvProduct.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
			dataGridViewCellStyle2.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvProduct.RowsDefaultCellStyle = dataGridViewCellStyle2;
			this.dgvProduct.RowTemplate.DefaultCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvProduct.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
			this.dgvProduct.Size = new Size(647, 512);
			this.dgvProduct.TabIndex = 1;
			this.Column2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
			this.Column2.DataPropertyName = "productName";
			this.Column2.HeaderText = "Sản phẩm";
			this.Column2.MinimumWidth = 100;
			this.Column2.Name = "Column2";
			this.Column2.ReadOnly = true;
			this.Column2.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column3.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column3.DataPropertyName = "productUnit";
			this.Column3.HeaderText = "Đơn vị tính";
			this.Column3.MinimumWidth = 100;
			this.Column3.Name = "Column3";
			this.Column3.ReadOnly = true;
			this.Column3.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column1.DataPropertyName = "Packet";
			this.Column1.HeaderText = "Số hiệu lô";
			this.Column1.MinimumWidth = 100;
			this.Column1.Name = "Column1";
			this.Column1.ReadOnly = true;
			this.Column1.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column7.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column7.DataPropertyName = "CreateDate";
			dataGridViewCellStyle3.Format = "D";
			dataGridViewCellStyle3.NullValue = null;
			this.Column7.DefaultCellStyle = dataGridViewCellStyle3;
			this.Column7.HeaderText = "Ngày HĐ";
			this.Column7.MinimumWidth = 86;
			this.Column7.Name = "Column7";
			this.Column7.ReadOnly = true;
			this.Column7.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column7.Width = 86;
			this.Column8.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column8.DataPropertyName = "ProductExpiryDate";
			dataGridViewCellStyle4.Format = "D";
			dataGridViewCellStyle4.NullValue = null;
			this.Column8.DefaultCellStyle = dataGridViewCellStyle4;
			this.Column8.HeaderText = "Hạn dùng";
			this.Column8.MinimumWidth = 90;
			this.Column8.Name = "Column8";
			this.Column8.ReadOnly = true;
			this.Column8.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column8.Width = 90;
			this.Column4.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column4.DataPropertyName = "productNumber";
			dataGridViewCellStyle5.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle5.Format = "N0";
			dataGridViewCellStyle5.NullValue = null;
			this.Column4.DefaultCellStyle = dataGridViewCellStyle5;
			this.Column4.HeaderText = "SL nhập";
			this.Column4.MinimumWidth = 65;
			this.Column4.Name = "Column4";
			this.Column4.ReadOnly = true;
			this.Column4.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column4.Width = 65;
			this.Column5.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column5.DataPropertyName = "ProductNumberOut";
			dataGridViewCellStyle6.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle6.Format = "N0";
			dataGridViewCellStyle6.NullValue = null;
			this.Column5.DefaultCellStyle = dataGridViewCellStyle6;
			this.Column5.HeaderText = "SL xuất";
			this.Column5.MinimumWidth = 65;
			this.Column5.Name = "Column5";
			this.Column5.ReadOnly = true;
			this.Column5.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column5.Width = 65;
			this.Column6.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column6.DataPropertyName = "ProductNumberBalancer";
			dataGridViewCellStyle7.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle7.Format = "N0";
			dataGridViewCellStyle7.NullValue = null;
			this.Column6.DefaultCellStyle = dataGridViewCellStyle7;
			this.Column6.HeaderText = "SL tồn";
			this.Column6.MinimumWidth = 65;
			this.Column6.Name = "Column6";
			this.Column6.ReadOnly = true;
			this.Column6.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column6.Width = 65;
			this.ProductPrice.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.ProductPrice.DataPropertyName = "ProductPrice";
			dataGridViewCellStyle8.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle8.Format = "N0";
			dataGridViewCellStyle8.NullValue = "0";
			this.ProductPrice.DefaultCellStyle = dataGridViewCellStyle8;
			this.ProductPrice.HeaderText = "Đơn giá";
			this.ProductPrice.MinimumWidth = 90;
			this.ProductPrice.Name = "ProductPrice";
			this.ProductPrice.ReadOnly = true;
			this.ProductPrice.Width = 90;
			this.Column10.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column10.DataPropertyName = "ProductMoney";
			dataGridViewCellStyle9.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle9.Format = "N0";
			dataGridViewCellStyle9.NullValue = "0";
			this.Column10.DefaultCellStyle = dataGridViewCellStyle9;
			this.Column10.HeaderText = "Tổng tiền";
			this.Column10.MinimumWidth = 90;
			this.Column10.Name = "Column10";
			this.Column10.ReadOnly = true;
			this.Column10.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column10.Width = 90;
			this.Column9.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column9.DataPropertyName = "Pid";
			this.Column9.HeaderText = "Mã sản phẩm";
			this.Column9.Name = "Column9";
			this.Column9.ReadOnly = true;
			this.Column9.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.Column9.Visible = false;
			this.btnClose.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.btnClose.BackColor = SystemColors.ButtonFace;
			this.btnClose.FlatAppearance.BorderColor = Color.FromArgb(255, 192, 255);
			this.btnClose.FlatStyle = FlatStyle.Flat;
			this.btnClose.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnClose.Location = new System.Drawing.Point(788, 563);
			this.btnClose.Name = "btnClose";
			this.btnClose.Size = new Size(100, 26);
			this.btnClose.TabIndex = 38;
			this.btnClose.Text = "Thoát  [ ESC ]";
			this.btnClose.UseVisualStyleBackColor = false;
			this.btnClose.Click += new EventHandler(this.btnClose_Click);
			this.groupBox1.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left);
			this.groupBox1.Controls.Add(this.cbbType);
			this.groupBox1.Controls.Add(this.ckbProduct);
			this.groupBox1.Controls.Add(this.dgvListProduct);
			this.groupBox1.Controls.Add(this.label5);
			this.groupBox1.Controls.Add(this.label4);
			this.groupBox1.Controls.Add(this.cbbWareHouse);
			this.groupBox1.Controls.Add(this.txtSearch);
			this.groupBox1.Controls.Add(this.cbbParentGID);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.groupBox1.Location = new System.Drawing.Point(7, 5);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new Size(233, 589);
			this.groupBox1.TabIndex = 39;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Điều kiện tìm kiếm";
			this.cbbType.BackColor = Color.White;
			this.cbbType.Cursor = Cursors.Hand;
			this.cbbType.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbType.FlatStyle = FlatStyle.Flat;
			this.cbbType.Font = new Font("Arial", 8.5f, FontStyle.Bold);
			this.cbbType.FormattingEnabled = true;
			this.cbbType.Items.AddRange(new object[]
			{
				"Thuốc bán theo đơn",
				"Thuốc bán không theo đơn",
				"Tất cả loại thuốc"
			});
			this.cbbType.Location = new System.Drawing.Point(10, 127);
			this.cbbType.Name = "cbbType";
			this.cbbType.Size = new Size(212, 22);
			this.cbbType.TabIndex = 96;
			this.cbbType.SelectedIndexChanged += new EventHandler(this.cbbType_SelectedIndexChanged);
			this.ckbProduct.AutoSize = true;
			this.ckbProduct.Location = new System.Drawing.Point(12, 217);
			this.ckbProduct.Name = "ckbProduct";
			this.ckbProduct.Size = new Size(139, 19);
			this.ckbProduct.TabIndex = 95;
			this.ckbProduct.Text = "Xem theo sản phẩm";
			this.ckbProduct.UseVisualStyleBackColor = true;
			this.dgvListProduct.AllowUserToAddRows = false;
			this.dgvListProduct.AllowUserToDeleteRows = false;
			this.dgvListProduct.AllowUserToResizeColumns = false;
			this.dgvListProduct.AllowUserToResizeRows = false;
			dataGridViewCellStyle10.BackColor = Color.FromArgb(192, 255, 255);
			dataGridViewCellStyle10.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.dgvListProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle10;
			this.dgvListProduct.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left);
			this.dgvListProduct.BackgroundColor = Color.White;
			this.dgvListProduct.BorderStyle = BorderStyle.Fixed3D;
			this.dgvListProduct.CellBorderStyle = DataGridViewCellBorderStyle.Raised;
			this.dgvListProduct.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
			dataGridViewCellStyle11.BackColor = SystemColors.Control;
			dataGridViewCellStyle11.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			dataGridViewCellStyle11.ForeColor = SystemColors.WindowText;
			dataGridViewCellStyle11.SelectionBackColor = Color.Aqua;
			dataGridViewCellStyle11.SelectionForeColor = Color.Black;
			this.dgvListProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11;
			this.dgvListProduct.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
			this.dgvListProduct.Columns.AddRange(new DataGridViewColumn[]
			{
				this.dg2,
				this.dg6
			});
			this.dgvListProduct.Cursor = Cursors.Hand;
			this.dgvListProduct.EnableHeadersVisualStyles = false;
			this.dgvListProduct.Location = new System.Drawing.Point(10, 239);
			this.dgvListProduct.MultiSelect = false;
			this.dgvListProduct.Name = "dgvListProduct";
			this.dgvListProduct.ReadOnly = true;
			dataGridViewCellStyle12.BackColor = SystemColors.Control;
			dataGridViewCellStyle12.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			dataGridViewCellStyle12.ForeColor = Color.Black;
			dataGridViewCellStyle12.SelectionBackColor = Color.Aqua;
			dataGridViewCellStyle12.SelectionForeColor = Color.Black;
			this.dgvListProduct.RowHeadersDefaultCellStyle = dataGridViewCellStyle12;
			this.dgvListProduct.RowHeadersVisible = false;
			this.dgvListProduct.RowHeadersWidth = 26;
			this.dgvListProduct.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
			dataGridViewCellStyle13.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvListProduct.RowsDefaultCellStyle = dataGridViewCellStyle13;
			this.dgvListProduct.RowTemplate.DefaultCellStyle.BackColor = Color.White;
			this.dgvListProduct.RowTemplate.DefaultCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.dgvListProduct.RowTemplate.DefaultCellStyle.ForeColor = Color.Black;
			this.dgvListProduct.RowTemplate.DefaultCellStyle.SelectionBackColor = Color.Aqua;
			this.dgvListProduct.RowTemplate.DefaultCellStyle.SelectionForeColor = Color.Black;
			this.dgvListProduct.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
			this.dgvListProduct.Size = new Size(212, 340);
			this.dgvListProduct.TabIndex = 94;
			this.dgvListProduct.CellEnter += new DataGridViewCellEventHandler(this.dgvRep_CellEnter);
			this.dg2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
			this.dg2.DataPropertyName = "productName";
			dataGridViewCellStyle14.Alignment = DataGridViewContentAlignment.MiddleLeft;
			dataGridViewCellStyle14.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
			dataGridViewCellStyle14.NullValue = null;
			this.dg2.DefaultCellStyle = dataGridViewCellStyle14;
			this.dg2.HeaderText = "Tên sản phẩm";
			this.dg2.MinimumWidth = 120;
			this.dg2.Name = "dg2";
			this.dg2.ReadOnly = true;
			this.dg6.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dg6.DataPropertyName = "PID";
			this.dg6.HeaderText = "PID";
			this.dg6.Name = "dg6";
			this.dg6.ReadOnly = true;
			this.dg6.Resizable = DataGridViewTriState.False;
			this.dg6.Visible = false;
			this.dg6.Width = 5;
			this.label5.BackColor = SystemColors.ControlLight;
			this.label5.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label5.Location = new System.Drawing.Point(10, 158);
			this.label5.Name = "label5";
			this.label5.Size = new Size(212, 23);
			this.label5.TabIndex = 93;
			this.label5.Text = "Tìm theo tên thuốc - vật tư";
			this.label5.TextAlign = ContentAlignment.MiddleCenter;
			this.label4.BackColor = SystemColors.ControlLight;
			this.label4.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label4.Location = new System.Drawing.Point(10, 20);
			this.label4.Name = "label4";
			this.label4.Size = new Size(212, 23);
			this.label4.TabIndex = 92;
			this.label4.Text = "Kho hàng";
			this.label4.TextAlign = ContentAlignment.MiddleCenter;
			this.cbbWareHouse.BackColor = Color.White;
			this.cbbWareHouse.Cursor = Cursors.Hand;
			this.cbbWareHouse.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbWareHouse.FlatStyle = FlatStyle.Flat;
			this.cbbWareHouse.Font = new Font("Arial", 8.5f, FontStyle.Bold);
			this.cbbWareHouse.FormattingEnabled = true;
			this.cbbWareHouse.Location = new System.Drawing.Point(10, 44);
			this.cbbWareHouse.Name = "cbbWareHouse";
			this.cbbWareHouse.Size = new Size(212, 22);
			this.cbbWareHouse.TabIndex = 90;
			this.cbbWareHouse.SelectedIndexChanged += new EventHandler(this.cbbWareHouse_SelectedIndexChanged);
			this.txtSearch.BackColor = Color.White;
			this.txtSearch.Font = new Font("Arial", 11.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtSearch.Location = new System.Drawing.Point(10, 181);
			this.txtSearch.Name = "txtSearch";
			this.txtSearch.Size = new Size(212, 25);
			this.txtSearch.TabIndex = 51;
			this.txtSearch.TextChanged += new EventHandler(this.txtSearch_TextChanged);
			this.txtSearch.KeyDown += new KeyEventHandler(this.txtSearch_KeyDown);
			this.cbbParentGID.BackColor = Color.White;
			this.cbbParentGID.Cursor = Cursors.Hand;
			this.cbbParentGID.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbParentGID.FlatStyle = FlatStyle.Flat;
			this.cbbParentGID.Font = new Font("Arial", 8.5f, FontStyle.Bold);
			this.cbbParentGID.FormattingEnabled = true;
			this.cbbParentGID.Location = new System.Drawing.Point(10, 99);
			this.cbbParentGID.Name = "cbbParentGID";
			this.cbbParentGID.Size = new Size(212, 22);
			this.cbbParentGID.TabIndex = 40;
			this.cbbParentGID.SelectedIndexChanged += new EventHandler(this.cbbParentGID_SelectedIndexChanged);
			this.cbbParentGID.SelectedValueChanged += new EventHandler(this.cbbParentGID_SelectedIndexChanged);
			this.label1.BackColor = SystemColors.ControlLight;
			this.label1.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label1.Location = new System.Drawing.Point(10, 75);
			this.label1.Name = "label1";
			this.label1.Size = new Size(212, 23);
			this.label1.TabIndex = 41;
			this.label1.Text = "Nhóm thuốc - vật tư";
			this.label1.TextAlign = ContentAlignment.MiddleCenter;
			this.btnPrint.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnPrint.BackColor = SystemColors.ButtonFace;
			this.btnPrint.Enabled = false;
			this.btnPrint.FlatAppearance.BorderColor = Color.FromArgb(255, 192, 255);
			this.btnPrint.FlatStyle = FlatStyle.Flat;
			this.btnPrint.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnPrint.Location = new System.Drawing.Point(386, 563);
			this.btnPrint.Name = "btnPrint";
			this.btnPrint.Size = new Size(108, 26);
			this.btnPrint.TabIndex = 40;
			this.btnPrint.Text = "In báo cáo [ F7 ]";
			this.btnPrint.UseVisualStyleBackColor = false;
			this.btnPrint.Click += new EventHandler(this.btnPrint_Click_1);
			this.btnSearch.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnSearch.BackColor = SystemColors.ButtonFace;
			this.btnSearch.FlatAppearance.BorderColor = Color.FromArgb(255, 192, 255);
			this.btnSearch.FlatStyle = FlatStyle.Flat;
			this.btnSearch.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnSearch.Location = new System.Drawing.Point(252, 563);
			this.btnSearch.Name = "btnSearch";
			this.btnSearch.Size = new Size(130, 26);
			this.btnSearch.TabIndex = 41;
			this.btnSearch.Text = "Xem tẩt cả hàng tồn";
			this.btnSearch.UseVisualStyleBackColor = false;
			this.btnSearch.Click += new EventHandler(this.btnSearch_Click);
			this.btnExportToExcel.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnExportToExcel.BackColor = SystemColors.ButtonFace;
			this.btnExportToExcel.Enabled = false;
			this.btnExportToExcel.FlatAppearance.BorderColor = Color.FromArgb(255, 192, 255);
			this.btnExportToExcel.FlatStyle = FlatStyle.Flat;
			this.btnExportToExcel.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnExportToExcel.Location = new System.Drawing.Point(498, 563);
			this.btnExportToExcel.Name = "btnExportToExcel";
			this.btnExportToExcel.Size = new Size(105, 26);
			this.btnExportToExcel.TabIndex = 43;
			this.btnExportToExcel.Text = "Xuất File Excel";
			this.btnExportToExcel.UseVisualStyleBackColor = false;
			this.btnExportToExcel.Click += new EventHandler(this.btnExportToExcel_Click);
			this.lblSumMoney.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.lblSumMoney.BackColor = Color.White;
			this.lblSumMoney.BorderStyle = BorderStyle.Fixed3D;
			this.lblSumMoney.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.lblSumMoney.Location = new System.Drawing.Point(788, 532);
			this.lblSumMoney.Name = "lblSumMoney";
			this.lblSumMoney.Size = new Size(100, 20);
			this.lblSumMoney.TabIndex = 61;
			this.lblSumMoney.Text = "-:-";
			this.lblSumMoney.TextAlign = ContentAlignment.MiddleRight;
			this.lblSumOut.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.lblSumOut.BackColor = Color.White;
			this.lblSumOut.BorderStyle = BorderStyle.Fixed3D;
			this.lblSumOut.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.lblSumOut.Location = new System.Drawing.Point(565, 532);
			this.lblSumOut.Name = "lblSumOut";
			this.lblSumOut.Size = new Size(63, 20);
			this.lblSumOut.TabIndex = 62;
			this.lblSumOut.Text = "-:-";
			this.lblSumOut.TextAlign = ContentAlignment.MiddleRight;
			this.lblSumIn.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.lblSumIn.BackColor = Color.White;
			this.lblSumIn.BorderStyle = BorderStyle.Fixed3D;
			this.lblSumIn.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.lblSumIn.Location = new System.Drawing.Point(500, 532);
			this.lblSumIn.Name = "lblSumIn";
			this.lblSumIn.Size = new Size(63, 20);
			this.lblSumIn.TabIndex = 63;
			this.lblSumIn.Text = "-:-";
			this.lblSumIn.TextAlign = ContentAlignment.MiddleRight;
			this.lblSumBalancer.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.lblSumBalancer.BackColor = Color.White;
			this.lblSumBalancer.BorderStyle = BorderStyle.Fixed3D;
			this.lblSumBalancer.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.lblSumBalancer.Location = new System.Drawing.Point(631, 532);
			this.lblSumBalancer.Name = "lblSumBalancer";
			this.lblSumBalancer.Size = new Size(63, 20);
			this.lblSumBalancer.TabIndex = 64;
			this.lblSumBalancer.Text = "-:-";
			this.lblSumBalancer.TextAlign = ContentAlignment.MiddleRight;
			this.lblCountItem.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.lblCountItem.BackColor = Color.White;
			this.lblCountItem.BorderStyle = BorderStyle.Fixed3D;
			this.lblCountItem.Location = new System.Drawing.Point(252, 532);
			this.lblCountItem.Name = "lblCountItem";
			this.lblCountItem.Size = new Size(244, 20);
			this.lblCountItem.TabIndex = 65;
			this.lblCountItem.Text = "-:- ";
			this.lblCountItem.TextAlign = ContentAlignment.MiddleCenter;
			this.btnMakeOrderBill.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnMakeOrderBill.BackColor = SystemColors.ButtonFace;
			this.btnMakeOrderBill.Enabled = false;
			this.btnMakeOrderBill.FlatAppearance.BorderColor = Color.FromArgb(255, 192, 255);
			this.btnMakeOrderBill.FlatStyle = FlatStyle.Flat;
			this.btnMakeOrderBill.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnMakeOrderBill.Location = new System.Drawing.Point(607, 563);
			this.btnMakeOrderBill.Name = "btnMakeOrderBill";
			this.btnMakeOrderBill.Size = new Size(121, 26);
			this.btnMakeOrderBill.TabIndex = 66;
			this.btnMakeOrderBill.Text = "Tạo đơn đặt hàng";
			this.btnMakeOrderBill.UseVisualStyleBackColor = false;
			this.btnMakeOrderBill.Click += new EventHandler(this.btnMakeOrderBill_Click);
			this.label3.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.label3.BackColor = Color.White;
			this.label3.BorderStyle = BorderStyle.Fixed3D;
			this.label3.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label3.Location = new System.Drawing.Point(696, 532);
			this.label3.Name = "label3";
			this.label3.Size = new Size(90, 20);
			this.label3.TabIndex = 60;
			this.label3.Text = "Thành tiền :";
			this.label3.TextAlign = ContentAlignment.MiddleRight;
			this.label2.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.label2.BackColor = Color.White;
			this.label2.Location = new System.Drawing.Point(246, 527);
			this.label2.Name = "label2";
			this.label2.Size = new Size(648, 67);
			this.label2.TabIndex = 67;
			this.dataGridViewTextBoxColumn1.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
			this.dataGridViewTextBoxColumn1.DataPropertyName = "productName";
			dataGridViewCellStyle15.Alignment = DataGridViewContentAlignment.MiddleLeft;
			dataGridViewCellStyle15.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
			dataGridViewCellStyle15.NullValue = null;
			this.dataGridViewTextBoxColumn1.DefaultCellStyle = dataGridViewCellStyle15;
			this.dataGridViewTextBoxColumn1.HeaderText = "Tên sản phẩm";
			this.dataGridViewTextBoxColumn1.MinimumWidth = 120;
			this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
			this.dataGridViewTextBoxColumn2.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn2.DataPropertyName = "PID";
			this.dataGridViewTextBoxColumn2.HeaderText = "PID";
			this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
			this.dataGridViewTextBoxColumn2.Resizable = DataGridViewTriState.False;
			this.dataGridViewTextBoxColumn2.Visible = false;
			this.dataGridViewTextBoxColumn2.Width = 5;
			this.dataGridViewTextBoxColumn3.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
			this.dataGridViewTextBoxColumn3.DataPropertyName = "productName";
			this.dataGridViewTextBoxColumn3.HeaderText = "Sản phẩm";
			this.dataGridViewTextBoxColumn3.MinimumWidth = 100;
			this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
			this.dataGridViewTextBoxColumn3.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.dataGridViewTextBoxColumn4.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn4.DataPropertyName = "productUnit";
			this.dataGridViewTextBoxColumn4.HeaderText = "Đơn vị tính";
			this.dataGridViewTextBoxColumn4.MinimumWidth = 100;
			this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
			this.dataGridViewTextBoxColumn4.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.dataGridViewTextBoxColumn5.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn5.DataPropertyName = "Packet";
			this.dataGridViewTextBoxColumn5.HeaderText = "Số hiệu lô";
			this.dataGridViewTextBoxColumn5.MinimumWidth = 100;
			this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
			this.dataGridViewTextBoxColumn5.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.dataGridViewTextBoxColumn6.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn6.DataPropertyName = "CreateDate";
			dataGridViewCellStyle16.Format = "D";
			dataGridViewCellStyle16.NullValue = null;
			this.dataGridViewTextBoxColumn6.DefaultCellStyle = dataGridViewCellStyle16;
			this.dataGridViewTextBoxColumn6.HeaderText = "Ngày HĐ";
			this.dataGridViewTextBoxColumn6.MinimumWidth = 86;
			this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
			this.dataGridViewTextBoxColumn6.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.dataGridViewTextBoxColumn6.Width = 86;
			this.dataGridViewTextBoxColumn7.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn7.DataPropertyName = "ProductExpiryDate";
			dataGridViewCellStyle17.Format = "D";
			dataGridViewCellStyle17.NullValue = null;
			this.dataGridViewTextBoxColumn7.DefaultCellStyle = dataGridViewCellStyle17;
			this.dataGridViewTextBoxColumn7.HeaderText = "Hạn dùng";
			this.dataGridViewTextBoxColumn7.MinimumWidth = 90;
			this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
			this.dataGridViewTextBoxColumn7.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.dataGridViewTextBoxColumn7.Width = 90;
			this.dataGridViewTextBoxColumn8.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn8.DataPropertyName = "productNumber";
			dataGridViewCellStyle18.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle18.Format = "N0";
			dataGridViewCellStyle18.NullValue = null;
			this.dataGridViewTextBoxColumn8.DefaultCellStyle = dataGridViewCellStyle18;
			this.dataGridViewTextBoxColumn8.HeaderText = "SL nhập";
			this.dataGridViewTextBoxColumn8.MinimumWidth = 65;
			this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8";
			this.dataGridViewTextBoxColumn8.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.dataGridViewTextBoxColumn8.Width = 65;
			this.dataGridViewTextBoxColumn9.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn9.DataPropertyName = "ProductNumberOut";
			dataGridViewCellStyle19.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle19.Format = "N0";
			dataGridViewCellStyle19.NullValue = null;
			this.dataGridViewTextBoxColumn9.DefaultCellStyle = dataGridViewCellStyle19;
			this.dataGridViewTextBoxColumn9.HeaderText = "SL xuất";
			this.dataGridViewTextBoxColumn9.MinimumWidth = 65;
			this.dataGridViewTextBoxColumn9.Name = "dataGridViewTextBoxColumn9";
			this.dataGridViewTextBoxColumn9.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.dataGridViewTextBoxColumn9.Width = 65;
			this.dataGridViewTextBoxColumn10.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn10.DataPropertyName = "ProductNumberBalancer";
			dataGridViewCellStyle20.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle20.Format = "N0";
			dataGridViewCellStyle20.NullValue = null;
			this.dataGridViewTextBoxColumn10.DefaultCellStyle = dataGridViewCellStyle20;
			this.dataGridViewTextBoxColumn10.HeaderText = "SL tồn";
			this.dataGridViewTextBoxColumn10.MinimumWidth = 65;
			this.dataGridViewTextBoxColumn10.Name = "dataGridViewTextBoxColumn10";
			this.dataGridViewTextBoxColumn10.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.dataGridViewTextBoxColumn10.Width = 65;
			this.dataGridViewTextBoxColumn11.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn11.DataPropertyName = "ProductPrice";
			dataGridViewCellStyle21.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle21.Format = "N0";
			dataGridViewCellStyle21.NullValue = "0";
			this.dataGridViewTextBoxColumn11.DefaultCellStyle = dataGridViewCellStyle21;
			this.dataGridViewTextBoxColumn11.HeaderText = "Đơn giá";
			this.dataGridViewTextBoxColumn11.MinimumWidth = 90;
			this.dataGridViewTextBoxColumn11.Name = "dataGridViewTextBoxColumn11";
			this.dataGridViewTextBoxColumn11.Width = 90;
			this.dataGridViewTextBoxColumn12.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn12.DataPropertyName = "ProductMoney";
			dataGridViewCellStyle22.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle22.Format = "N0";
			dataGridViewCellStyle22.NullValue = "0";
			this.dataGridViewTextBoxColumn12.DefaultCellStyle = dataGridViewCellStyle22;
			this.dataGridViewTextBoxColumn12.HeaderText = "Tổng tiền";
			this.dataGridViewTextBoxColumn12.MinimumWidth = 90;
			this.dataGridViewTextBoxColumn12.Name = "dataGridViewTextBoxColumn12";
			this.dataGridViewTextBoxColumn12.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.dataGridViewTextBoxColumn12.Width = 90;
			this.dataGridViewTextBoxColumn13.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn13.DataPropertyName = "Pid";
			this.dataGridViewTextBoxColumn13.HeaderText = "Mã sản phẩm";
			this.dataGridViewTextBoxColumn13.Name = "dataGridViewTextBoxColumn13";
			this.dataGridViewTextBoxColumn13.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.dataGridViewTextBoxColumn13.Visible = false;
			base.AutoScaleDimensions = new SizeF(7f, 15f);
			//base.AutoScaleMode = AutoScaleMode.Font;
			base.ClientSize = new Size(900, 600);
			base.Controls.Add(this.btnMakeOrderBill);
			base.Controls.Add(this.lblCountItem);
			base.Controls.Add(this.lblSumBalancer);
			base.Controls.Add(this.lblSumIn);
			base.Controls.Add(this.lblSumOut);
			base.Controls.Add(this.lblSumMoney);
			base.Controls.Add(this.label3);
			base.Controls.Add(this.btnExportToExcel);
			base.Controls.Add(this.btnSearch);
			base.Controls.Add(this.btnPrint);
			base.Controls.Add(this.btnClose);
			base.Controls.Add(this.dgvProduct);
			base.Controls.Add(this.groupBox1);
			base.Controls.Add(this.label2);
			this.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
			//base.Icon = (System.Drawing.Icon)componentResourceManager.GetObject("$this.Icon");
			//base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
			base.KeyPreview = true;
			base.Name = "frmBalancer";
			base.ShowInTaskbar = false;
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "HÀNG TỒN KHO";
			base.WindowState = FormWindowState.Maximized;
			base.Load += new EventHandler(this.frmInput_Load);
			base.KeyDown += new KeyEventHandler(this.frmInput_KeyDown);
			((ISupportInitialize)this.dgvProduct).EndInit();
			this.groupBox1.ResumeLayout(false);
			this.groupBox1.PerformLayout();
			((ISupportInitialize)this.dgvListProduct).EndInit();
			base.ResumeLayout(false);
		}
	}
}
